package updateDatabases;

import java.util.HashMap;
import java.util.Map;

/**
 * Sends the form value to the server to update the values.
 * 
 * @author Yahweh Yago
 * 
 */

public class UpdateDatabase {

  /**
   * Executes the update.
   * 
   * @param params the form values to send
   * @return
   */
  protected static String execute(String... params) {
    String gameName = params[0];
    String metaCritic = params[1];
    String gameStop = params[2];
    String Ign = params[3];

    Map<String, String> requestParams = new HashMap<String, String>();
    requestParams.put("gameName", gameName);
    requestParams.put("metacriticRating", metaCritic);
    requestParams.put("gamestopRating", gameStop);
    requestParams.put("ignRating", Ign);

    String response =
        Ajax.send("http://ratethatgame.web44.net/ics414/update_ratings.php", requestParams);

    return response;
  }
}
